The host protected area, sometimes referred to as hidden protected area[1], is an area of a hard drive that is not normally visible to an operating system (OS).
Contents |
HPA was first introduced in the ATA-4 standard cxv (T13, 2001).[2]
The IDE controller has registers that contain data that can be queried using ATA commands. The data returned gives information about the drive attached to the controller. There are three ATA commands involved in creating and using a hidden protected area. The commands are:
Operating systems use the IDENTIFY DEVICE command to find out the addressable space of a hard drive. The IDENTIFY DEVICE command queries a particular register on the IDE controller to establish the size of a drive.
This register however can be changed using the SET MAX ADDRESS ATA command. If the value in the register is set to less than the actual hard drive size then effectively a host protected area is created. It is protected because the OS will work with only the value in the register that is returned by the IDENTIFY DEVICE command and thus will normally be unable to address the parts of the drive that lie within the HPA.
The HPA is useful only if other software or firmware (e.g. BIOS) is able to use it. Software and firmware that are able to use the HPA are referred to as 'HPA aware'. The ATA command that these entities use is called READ NATIVE MAX ADDRESS. This command accesses a register that contains the true size of the hard drive. To use the area, the controlling HPA-aware program changes the value of the register read by IDENTIFY DEVICE to that found in the register read by READ NATIVE MAX ADDRESS. When its operations are complete, the register read by IDENTIFY DEVICE is returned to its original fake value.
Identification of HPA on a hard drive can be achieved by a number of tools and methods.
Using Linux, there are a couple of ways to detect the existence of an HPA. The latest Linux versions will print a message when the system is booting. For example:
dmesg | less [...] hdb: Host Protected Area detected. current capacity is 12000 sectors (6 MB) native capacity is 120103200 sectors (61492 MB)
With program hdparm, version >= 8.0, where X is your drive letter:
hdparm -N /dev/sdX
For versions of hdparm < 8, one can compare the number of sectors output from 'hdparm -I' with the number of sectors reported for the hard drive model's published statistics.
Creating and manipulating HPA on a hard drive can be achieved by a number of tools.
Using the Linux program hdparm with version >=8.0 you can modify the HPA directly. Where ABC is the number of visible sectors and X is the drive letter:
hdparm -NpABC /dev/sdX